﻿using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace HEFramework
{
    public class HUDText : Entity, IAwake, IUpdate, IDestroy
    {
        public class HUDTextElement
        {
            /// <summary>
            /// 对象
            /// </summary>
            public GameObject Object { get; set; }

            /// <summary>
            /// 文本
            /// </summary>
            public TMP_Text Text { get; set; }

            /// <summary>
            /// 图标
            /// </summary>
            public Image Icon { get; set; }

            /// <summary>
            /// 弹出速度
            /// </summary>
            public float Speed { get; set; }

            /// <summary>
            /// 弹出衰减力度
            /// </summary>
            public float Speed_Weak { get; set; }

            /// <summary>
            /// 等待隐藏时间
            /// </summary>
            public float Weak_Time { get; set; }

            /// <summary>
            /// 透明度
            /// </summary>
            public float Alpha { get; set; }

            /// <summary>
            /// 透明衰减力度
            /// </summary>
            public float Alpha_Weak { get; set; }


            /// <summary>
            /// 是否激活中
            /// </summary>
            public bool IsActive
            {
                get { return Text.gameObject.activeSelf; }
                set { Text.gameObject.SetActive(value); }
            }

            /// <summary>
            /// 是否空闲
            /// </summary>
            public bool IsFree { get; set; }
        }

        public List<HUDTextElement> Elements { get; } = new();
        public int Index { get; set; }
    }
}